//
//  main.c
//  memcpy模拟实现
//
//  Created by 卜绎皓 on 2022/4/14.
//

#include<stdio.h>
#include<assert.h>
void*my_memcpy(void* dest, const void* src, size_t count)
{
    assert(dest && src);
    char* start = (char*)dest;
    while (count--)
    {
        *(char*)dest = *(char*)src;
        dest = (char*)dest + 1;
        src = (char*)src + 1;
    }
    return start;
}
int main()
{
    int arr1[100] = {};
    int arr2[] = { 1,2,3,4,5 };
    my_memcpy(arr1, arr2, 20);
 
    for (int i = 0; i < 5; i++)
    {
        printf("%d ", arr1[i]);
    }
 
    return 0;
}

